﻿from pathlib import Path
path = Path(r"前端/app/src/main/kotlin/com/sgcc/nfc/lock/domain/model/LockModels.kt")
text = path.read_text(encoding="utf-8")
old = "data class Lock(\n    val lockId: Long,\n    val lockName: String,\n    val lockNfcId: String,\n    val lockType: LockType,\n    val status: LockStatus,\n    val batteryLevel: Int?,\n    val lastHeartbeat: String?,\n    val roomId: Long?,\n    val roomName: String?,\n    val latitude: Double?,\n    val longitude: Double?,\n    val address: String?\n) : Parcelable\n"
new = "data class Lock(\n    val lockId: Long,\n    val lockName: String,\n    val lockNfcId: String,\n    val deviceCode: String?,\n    val lockPassword: String?,\n    val lockType: LockType,\n    val status: LockStatus,\n    val batteryLevel: Int?,\n    val lastHeartbeat: String?,\n    val roomId: Long?,\n    val roomName: String?,\n    val latitude: Double?,\n    val longitude: Double?,\n    val address: String?\n) : Parcelable\n"
if old not in text:
    raise SystemExit('pattern not found')
text = text.replace(old, new)
path.write_text(text, encoding='utf-8')
